<html>
<head>
    <title>Title</title>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</head>
<body>
    <form action="http://127.0.0.1:8080/jwt/user/login" method="post" id = "form">
        账号:<input type="text" name = "account"/><br/>
        密码：<input type="password" name = "pwd"/><br/>
        <input type="submit" value="登录"/>
    </form>

    <script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="../../js/jquery-form.js"></script>
    <script type="text/javascript">
        $("#form").submit(function () {
            //ajax异步提交表单
            $(this).ajaxSubmit({
                success:function (result){
                    //sessionStorage
                    localStorage.setItem("id",result.data.id);
                    localStorage.setItem("account",result.data.account);
                    localStorage.setItem("token",result.token);
                    location.href = "index.html";
                }
            });
            return false;//阻止原来的表单提交，采用ajax方式提交
        });
    </script>

</body>
</html>